package com.zl.learning.maven.javapack2;

import com.zl.learning.maven.javapack2.util.Env;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.util.Properties;

public class App {
    public static void main(String[] args) {
        try {
            Document doc = Jsoup.connect("https://www.cnblogs.com/dzblog/p/6913809.html").get();
            System.out.println(doc.body());

//            Path basePath = Paths.get(App.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
//            Properties prop = new Properties();
//            prop.load(Files.newBufferedReader(Paths.get(basePath.toString(), "prop.conf")));
//            System.out.println(prop.getProperty("username"));
//            System.out.println(basePath.getParent());
//            TimeUnit.MINUTES.sleep(10);

//            Properties prop2 = new Properties();
//            prop2.load(new InputStreamReader(App.class.getClassLoader().getResourceAsStream("prop.conf"), StandardCharsets.UTF_8));
//            System.out.println(prop2.getProperty("username"));
            Properties prop = new Properties();
            prop.load(Env.getDefaultClassLoader().getResourceAsStream("prop.conf"));
            System.out.println(prop);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
